package by.amakarevich.webapp.page.address;

import java.util.List;

import javax.inject.Inject;

import org.apache.wicket.MarkupContainer;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.ResourceModel;

import by.amakarevich.datamodel.Booking;
import by.amakarevich.datamodel.DeliveryAddress;
import by.amakarevich.datamodel.Product;
import by.amakarevich.datamodel.ShoppingCart;
import by.amakarevich.datamodel.ShoppingCartInfo;
import by.amakarevich.datamodel.UserAccount;
import by.amakarevich.services.DeliveryAddressService;
import by.amakarevich.services.ShoppingCartInfoService;
import by.amakarevich.services.ShoppingCartService;
import by.amakarevich.webapp.app.BasicAuthenticationSession;
import by.amakarevich.webapp.page.AlternativeBaseLayout;
import by.amakarevich.webapp.page.shoppingcart.panel.ShoppingCartInfoPanel;

public class DeliveryAddressPage extends AlternativeBaseLayout {
	
	@Inject
	private DeliveryAddressService deliveryAddressService;
	
	private DeliveryAddress deliveryAddress;
	private Booking booking;
	
	public DeliveryAddressPage(Booking booking){
		this.booking=booking;
	}
	
	
	@Override
	protected void onInitialize() {
		super.onInitialize();
		
		WebMarkupContainer container = new WebMarkupContainer("adress");
		add(container);
		
		deliveryAddress = deliveryAddressService.getByBooking(booking);
		
		container.add(new Label("booking", new Model<Long>(booking.getId())));
		container.add(new Label("city", new Model<String>(deliveryAddress.getCity())));
		container.add(new Label("street", new Model<String>(deliveryAddress.getStreet())));
		container.add(new Label("house", new Model<String>(deliveryAddress.getHouse())));
		container.add(new Label("apartment", new Model<String>(deliveryAddress.getApartment())));
		container.add(new Label("contactPhone", new Model<Long>(deliveryAddress.getContactPhone())));
		container.add(new Label("contactPersonName", new Model<String>(deliveryAddress.getContactPersonName())));
		container.add(new Label("contactPersonLastName", new Model<String>(deliveryAddress.getContactPersonLastName())));
	}


	@Override
	protected IModel<String> getPageTitle() {
		return new ResourceModel("p.delivery.adress.title");
	}
			
		
}
